Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaves -- Janice #33

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Leaves -- Janice #33

wants to merge 11 commits into from

Conversation

jaitch
Copy link

@jaitch jaitch commented Aug 12, 2019

ride share

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
What did your data structure look like at first? Did this structure evolve over time? Why? At first I had arrays with variable names that were driver IDs. It quickly became clear that I needed those driver IDs to be keys for hashes so I could call specific drivers' information.
What was your strategy for going through the data structure and gathering information? The most helpful strategy was to organize the data as separate hashes of individual rides, with the data for each ride within the hash. This made it easy to iterate through the hashes and collect needed information.
What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? I stored the average rating of each driver in a variable (and then within a new hash), which was useful for when I was again using these numbers to find the driver with the highest average rating.
What kinds of iteration did you use? Did you use .map? If so, when? If not, why, or when would be a good opportunity to use it? I used .each and .map. I used .map to make arrays of just the data I needed-- the amounts made by the drivers and their ratings (two separate arrays). This made it easy to apply the .sum method to the new arrays.
Were some calculations easier than others? Why? Yes, the ones with built-in methods (.sum, I'm looking at you) were easier. The trickiest calculation was combining the earnings of repeated dates in order to find each driver's most lucrative date.

@jaitch jaitch closed this Aug 12, 2019
@jaitch jaitch changed the title ride-share Leaves -- Janice Aug 12, 2019
@jaitch jaitch reopened this Aug 12, 2019

# Store new data in a hash of hashes
new_data[driver] = {
total_moolah: cost_array.sum,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moolah, nice!

# Step 3: Make the data structure!
# Determine which driver made the most money and which had the highest avg rating
richest_driver = find_driver_with_max(new_data, :total_moolah)
best_driver = find_driver_with_max(new_data, :average_rating)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice use of helper methods here!

@dHelmgren
Copy link

Ride Share

What We're Looking For

Feature Feedback
Answers the comprehension questions yes
Readable code with consistent indentation and reasonable code style yes
Outputs the correct number of rides each driver has given yes
Outputs the total amount of money each driver has made yes
Outputs the average rating for each driver yes
Outputs which driver made the most money yes
Outputs which driver has the highest average rating yes

Great work overall! I appreciate your use of helper methods to organize your code!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants